export function getBrowserLang() {
    // @ts-ignore;
    let browserLang = navigator.language ? navigator.language : navigator.browserLanguage;
    let defaultBrowserLang = "";
    if (["cn", "zh", "zh-cn"].includes(browserLang.toLowerCase())) {
        defaultBrowserLang = "zh";
    } else {
        defaultBrowserLang = "en";
    }
    return defaultBrowserLang;
}

export function filterByValue(list: LabelOptionList, value: any) {
    if(!list || !list.length) return undefined;
    else {
        if(value === undefined) return undefined;
        return list.find(item => item.value == value)?.label;
    }
}